<?php
	/*
	 * File: html_api.php
	 * Last modification: 22.07.2011
	 * Author(s): kivio.wanderley
	 * 
	 */
?>

<?php /** CENTER PHP CODE */
	
	/**
	 * Begins the html tag.
	 */
	function html_begin() {
		echo '<html>', "\n";
	}

	/**
	 * Ends the html tag.
	 */
	function html_end() {
		echo '</html>', "\n";
	}

	/**
	 * Begins the html head tag.
	 */
	function html_head_begin() {
		echo '<head>', "\n";
	}
	
	/**
	 * Ends the html head tag.
	 */
	function html_head_end() {
		echo '</head>', "\n";
	}

	/**
	 * Begins the html title tag.
	 * @param (string) $p_title Text on the title to show;
	 */
	function html_title_begin( $p_title ) {
		echo '<title>'.$p_title.'', "\n";
	}
	
	/**
	 * Ends the html title tag.
	 */
	function html_title_end() {
		echo '</title>', "\n";
	}

	/**
	 * Begins the html meta tag.
	 */
	function html_meta_begin() {
		echo '<meta>', "\n";
	}
	
	/**
	 * Ends the html meta tag.
	 */
	function html_meta_end() {
		echo '</meta>', "\n";
	}

	/**
	 * Begins the html body tag.
	 */
	function html_body_begin() {
		echo '<body>', "\n";
	}
	
	/**
	 * Ends the html body tag.
	 */
	function html_body_end() {
		echo '</body>', "\n";
	}
	
	/* ========================================
	 * Misc
	 * ========================================
	 */
	/**
	* Prints the legend for symbols and color used on required fields
	*/
	function html_print_required_legend() {
		PRINT '<table class="legend">';
		PRINT '<tr>';
		PRINT '<td><input type="text" class="legendtext" disabled/><tt class="reqsymbol">| </tt></td>';
		PRINT '<td>'.lang_get('required_field').'</td>';
		PRINT '</tr>';
		PRINT '<tr>';
		PRINT '<td><input type="text" class="legendempty" disabled/></td>';
		PRINT '<td>'.lang_get('invalid_field').'</td>';
		PRINT '</tr>';
		PRINT '</table>';
	}
	
	/**
	 * Prints on the bottom of the page the palette used on CSS
	 */
	function html_print_palette() {
		PRINT '<table class="palette">';
		PRINT '<tr>';
			PRINT '<td title="#97B251" style="background-color: #97B251;">&nbsp; </td>';
			PRINT '<td title="#333230" style="background-color: #333230;">&nbsp; </td>';
			PRINT '<td title="#736D61" style="background-color: #736D61;">&nbsp; </td>';
			PRINT '<td title="#BAAA90" style="background-color: #BAAA90;">&nbsp; </td>';
			PRINT '<td title="#FEE6BA" style="background-color: #FEE6BA;">&nbsp; </td>';
			PRINT '<td title="#FFFFFF" style="background-color: #FFFFFF;">&nbsp; </td>'; //white
			PRINT '<td title="#D3D3D3" style="background-color: #D3D3D3;">&nbsp; </td>';
			PRINT '<td title="#A9A9A9" style="background-color: #A9A9A9;">&nbsp; </td>';
			PRINT '<td title="#808080" style="background-color: #808080;">&nbsp; </td>';
			PRINT '<td title="#000000" style="background-color: #000000;">&nbsp; </td>'; //black
			PRINT '<td title="#FF0000" style="background-color: #FF0000;">&nbsp; </td>'; //red
			PRINT '<td title="#FFCCCC" style="background-color: #FFCCCC;">&nbsp; </td>';
		PRINT '</tr>';
		PRINT '</table>';
	}
	
	function html_print_information_div() {
		# System short messages on the top right of the window
		echo '<div class="information">';
		
		if( isset($_SESSION['info']) ) {
			PRINT '<table id="information_msg" class="width100" >';
			PRINT '<tr class="'.$_SESSION['info_class'].'">';
				PRINT '<td>'.$_SESSION['info'].'</td>';
			PRINT '</tr>';
			PRINT '</table>';
			# Clean information
			$_SESSION['info'] = $_SESSION['info_class'] = null;
		}
		
		echo '</div>';
	}
?>